This invention relates to the field of smart cards, and more particularly, this invention relates to a system and method for simulating USB smart cards.
Smart cards are plastic cards having an embedded Integrated Circuit (IC). That IC may be a logic circuit with its associated memories or a microcontroller with its associated memories and software, or a microcontroller with its associated memories and software coupled to a custom circuit block or interface.
To use the computing power of the IC, a smart card makes use of a full set of packaging technologies. For example, the die size varies from 1 mm2 to 30 mm2, but is limited because of the mechanical limitations imposed by the plastic construction of the smart card. The IC is attached to a lead frame and wire-bonding techniques are used to connect the IC pads to the lead frame contacts. Potting or other strengthening methods can be used to protect the IC against chemical and mechanical stresses during manufacturing and are a part of everyday usage of a smart card. Eight contacts are located on one side of the card. The smart card performs transactions with a smart card reader using a serial protocol. The mechanical and electrical specifications for a smart card are published by the International Standard Organization (ISO) as ISO7816-X standards, which have allowed the simple and massproduced magnetic stripe cards to evolve toward the smart card. This natural evaluation has allowed smart cards, depending of the IC complexity, of course, to perform pre-paid accounting, cryptographic scheme, personal authentication using a PIN code, biometrics, and java scripts, for example.
ISO documents ISO 7816-1 Physical Characteristics, ISO 7816-2 Dimensions and Locations of the contacts, ISO 7816-3 Electronic signals and transmission protocols, ISO 7816-4 Interindustry Commands for Interchange, and ISO 7816-10 Electronic signals and answer to reset for synchronous cards are incorporated herein by reference.
In operation, smart card readers are recognized by the reader infrastructure or a host computer prior to performing any transaction involving a smart card. The infrastructure runs an application involving the smart card. The half duplex protocol between the smart card and the smart card reader, in which either the smart card sends information to the smart card reader or vice versa, cannot start until a smart card is in place and detected by the smart card reader. The infrastructure manages authentication or transactions for pre-paid cards in public telephony, for Bankcards in Point-of-Sale (POS) terminals and Automatic Teller Machines (ATM), for Pay TV providers in set top boxes, and for wireless telecom operators in Subscriber Identification Modules (SIM) used in Global System for Mobile (CSM) terminals. Except for SIM cards, all other smart card reader applications use a physical sensor to detect the smart card. This sensor tells the smart card reader when a smart card is in place, i.e., when the smart card lead frame contacts mate with the smart card reader contacts.
When the smart card reader has established that a smart card is in place, a power-up sequence begins. After this power-up sequence has finished, the smart card reader typically provides a clock to the smart card and releases a reset signal. The smart card then executes its stored Operating System (OS). The SIM card, on the other hand, is in place only once with the power-off and used constantly subsequent to its positioning.
The first application for smart card technology was the public telephone system. The smart card die size was typically less than 1 mm2, and only memories and logic circuits were integrated in the IC. The smart card reader used all eight contacts to interface properly with the different smart card generations. When the smart card was inserted in the payphone, the telephone infrastructure authenticated the smart card and the telephone removed xe2x80x9cunitsxe2x80x9d from the smart card.
The banking industry subsequently adopted smart cards. The die size was about 10 mm2, and a microcontroller and its associated memories and software were integrated in the IC. The smart card reader used up to six contacts to interface properly with the different smart card generations. When a smart card was inserted in the ATM or the POS (point-of-sale), the smart card user was authenticated with a PIN code. The smart card could store different items, such as the balance of cash received from an ATM on a per week basis or details of purchases since a last closing date. Based on this information, authorization could be issued on the spot once the PIN had authenticated the debtor. This was accomplished without telephone calls to the bank.
Another application for smart cards has been developed by GSM manufacturers. The die size in a SIM is about 30 mm2, and a microcontroller and its associated memories and software are integrated in the IC. The SIM reader uses five contacts to interface properly with the smart card. The more sophisticated smart card applications are performed in GSM using Java applets.
A new market for the smart card has emerged with the growth of the internet accessed from a personal computer. Secure message, Public Key Infrastructure, Authentication and Electronic Payment are new smart card areas of interest. The smart card acts as an e-commerce facilitator. One advantage of a smart card compared to other solutions is the smart card PIN located in its memory that is never communicated in any transaction.
Presently, a smart card is inserted into a smart card reader connected to a host computer. Two protocols are involved in supporting transactions between the smart card and host computer. The first protocol complies with the ISO-7816-3, which provides detailed requirements for the serial interface between smart card and smart card reader. The reader is connected to the computer via a serial port, a parallel port, or the Universal Serial Bus (USB), using a second protocol. The smart card reader contains electronic circuits and embedded software that enable communication between the smart card using the first protocol and the host computer using the second protocol. The host computer is loaded with any appropriate drivers to support the smart card reader.
Many countries have begun to use the smart card in the PC environment. The die size used in these applications ranges from 5 mm2 to 30 mm2, and the microcontroller and its associated memories and software are integrated in the IC typically with a cryptocontroller. Sometimes, a bio-sensor is integrated. The smart card reader uses at least five contacts to interface properly with the smart card in these applications.
Since the late 1990""s, the universal serial bus (USB) has become firmly established and has gained wide acceptance in the PC marketplace. The USB was developed in response to a need for a standard interface that extends the concept of xe2x80x9cplug and playxe2x80x9d to devices external to a PC. It has enabled users to install and remove external peripheral devices without opening the PC case or removing power from the PC. The USB provides a low-cost, high performance, half-duplex serial interface that is easy to use and readily expandable.
USB uses four wires. The power supply is carried with two wires (VBus and ground), and data is carried with the other two wires (D+, Dxe2x88x92). The latest version of the USB is currently defined by the Universal Serial Bus Specification Revision 2.0, written and controlled by USB Implementers Forum, Inc., a non-profit corporation founded by the group of companies that developed the USB Specification.
In particular, Chapter 5 USB Data Flow Model, Chapter 7 Electrical, Chapter 8 Protocol Layer and Chapter 9 USB Device Framework of Universal Serial Bus Specification are incorporated herein by reference. The increasingly widespread use of the USB has led smart card reader manufacturers to develop USB interfaces for connection of their products to host computers to complement the existing serial and parallel interfaces.
Because the USB protocol is becoming increasingly important, it is necessary to develop products involving complex smart card devices for use with USB systems. To produce a functional equivalent of a smart card before the final product is available and any chips are manufactured, a simulator is developed on a software development computer and acts to xe2x80x9csimulatexe2x80x9d the behavior of the smart card. After the smart card program is assembled or compiled, the output is sent to the smart card simulator, which interprets the instructions it finds and runs the program to a break point (e.g., a stop or normal execution interrupt), or allows a user to single step the program and watch a change of state of the simulated smart card device. The communication interfaces of the smart card, including the various default pipe, pipe bundles, and USB wire are accomplished with the simulated software and associated devices.
Prior art solutions for developing USB smart card simulation programs and devices, USB smart card contacts, and software have included systems that simulate a xe2x80x9cvirtual USB hostxe2x80x9d and software that communicates with a smart card USB peripheral. Another prior art solution runs the program on a chip emulator as a step between running the smart card program in the simulator and running it on a smart card itself. The chip emulator contains the actual chip or design of the chip in a manner that will allow the tester to examine the internal state of the chip and single step the program. In the USB smart card context, the emulator is connected to a real USB host.
These prior art devices or systems often do not allow faithful and complete functionality adhering to all aspects of USB specifications. They often require a large number or enhanced processing power of hardware peripherals and require, in some cases, a xe2x80x9cvirtual USB hostxe2x80x9d to send the USB traffic to the simulator. If a xe2x80x9cvirtual USB hostxe2x80x9d is created, a possible wrong interpretation of the USB specification could be implemented. In some cases, several different operating behaviors of the virtual USB host must be developed because each computer operating system would implement a USB host having a different operating behavior. Even when a chip emulator is used, use of the emulator would still require a final debugging step.
It has also been known that depending upon capabilities built into software, virtual devices, such as a xe2x80x9cvirtual USB host,xe2x80x9d can exhibit different synchronization behaviors with actual physical devices. As a result of these and other problems, there is an inability to debug and validate embedded software with a simulator while in the context of the current environment or a final application for a USB smart card device. There is also the inability to use the simulator in the environment adhering to all aspects of the USB specifications. There is also the problem of connecting the simulator to a real USB host device and the resultant inability to debug and validate the USB PC driver of the final application using the simulator. Any USB system works as a slave/master system, and thus, it is impossible for two devices acting as master devices to communicate in the USB protocol.
It is therefore an object of the present invention to provide communications between a USB smart card simulator running on a software development computer and USB host controller that overcomes the disadvantages of prior art solutions noted above.
The present invention is advantageous and simulates a universal serial bus (USB) smart card device connected to a USB host device for development and debugging. A computer simulator has software that simulates a USB smart card device. The USB host device includes a USB host controller operatively connected along a communications link with the computer simulator for transmitting or receiving data packets to or from the computer simulator. A microcontroller is located in the communications link between the computer simulator and the USB host device and translates the data packets into a USB protocol to be used by the USB host device and defined by the computer simulator.
In one aspect of the present invention, the microcontroller can be a serial/USB translator interconnected between the computer simulator and the USB host device. The computer simulator can include a serial port connected to a serial communications line that is, in turn, connected to the microcontroller. The USB communications link can extend between the serial/USB translator and the USB host device.
In yet another aspect of the present invention, the microcontroller is operative for supporting control, bulk, interrupt, and/or isochronous USB transfer modes. A serial and USB peripheral can be controlled by the microcontroller.
In yet another aspect of the present invention, the microcontroller comprises a USB/USB translator. Two USB peripherals can be controlled by the microcontroller. A USB host controller can be operative with the computer simulator and connected to the communications link.
In yet another aspect of the present invention, the microcontroller has input and output software stacks for recording and aiding data packet transfers. The software stacks can store data regarding packet type, data payload, endpoint address, endpoint number and/or transfer state within each software stack.
A method for simulating a USB smart card device connected to a USB host device for development and debugging is also set forth.